<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>欢迎登录</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
            background-size: 400% 400%;
            animation: gradientBG 15s ease infinite;
            overflow: hidden;
        }

        @keyframes gradientBG {
            0% {
                background-position: 0% 50%;
            }
            50% {
                background-position: 100% 50%;
            }
            100% {
                background-position: 0% 50%;
            }
        }

        .container {
            position: relative;
            width: 400px;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 20px;
            box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
            padding: 40px;
            overflow: hidden;
            transition: all 0.5s ease;
            transform: translateY(0);
            animation: float 6s ease-in-out infinite;
        }

        @keyframes float {
            0%, 100% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-20px);
            }
        }

        .container::before {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: linear-gradient(to bottom right, transparent, rgba(255, 255, 255, 0.3), transparent);
            transform: rotate(45deg);
            animation: shine 3s infinite;
        }

        @keyframes shine {
            0% {
                left: -50%;
            }
            100% {
                left: 150%;
            }
        }

        h2 {
            text-align: center;
            margin-bottom: 30px;
            color: #333;
            font-size: 28px;
            font-weight: 600;
            position: relative;
        }

        h2::after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 50%;
            transform: translateX(-50%);
            width: 50px;
            height: 3px;
            background: linear-gradient(to right, #ff7b00, #ff006a);
            border-radius: 3px;
        }

        .input-group {
            position: relative;
            margin-bottom: 25px;
        }

        .input-group input {
            width: 100%;
            padding: 15px 20px;
            border: none;
            outline: none;
            background: rgba(0, 0, 0, 0.05);
            border-radius: 50px;
            font-size: 16px;
            color: #333;
            transition: all 0.3s ease;
        }

        .input-group input:focus {
            background: rgba(0, 0, 0, 0.1);
            box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.3);
        }

        .input-group label {
            position: absolute;
            top: 15px;
            left: 20px;
            color: #666;
            font-size: 16px;
            transition: all 0.3s ease;
            pointer-events: none;
        }

        .input-group input:focus + label,
        .input-group input:valid + label {
            top: -10px;
            left: 15px;
            font-size: 12px;
            background: white;
            padding: 0 5px;
            color: #ff7b00;
        }

        .remember-forgot {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 25px;
            font-size: 14px;
        }

        .remember-forgot label {
            display: flex;
            align-items: center;
            color: #666;
            cursor: pointer;
        }

        .remember-forgot input {
            margin-right: 5px;
            accent-color: #ff7b00;
        }

        .remember-forgot a {
            color: #666;
            text-decoration: none;
            transition: color 0.3s;
        }

        .remember-forgot a:hover {
            color: #ff006a;
            text-decoration: underline;
        }

        .btn {
            width: 100%;
            padding: 15px;
            border: none;
            outline: none;
            background: linear-gradient(to right, #ff7b00, #ff006a);
            color: white;
            font-size: 16px;
            font-weight: 600;
            border-radius: 50px;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            box-shadow: 0 5px 15px rgba(255, 0, 106, 0.3);
        }

        .btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(255, 0, 106, 0.4);
        }

        .btn:active {
            transform: translateY(0);
        }

        .btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            transition: 0.5s;
        }

        .btn:hover::before {
            left: 100%;
        }

        .social-login {
            text-align: center;
            margin-top: 30px;
        }

        .social-login p {
            color: #666;
            margin-bottom: 15px;
            position: relative;
        }

        .social-login p::before,
        .social-login p::after {
            content: '';
            position: absolute;
            top: 50%;
            width: 30%;
            height: 1px;
            background: #ddd;
        }

        .social-login p::before {
            left: 0;
        }

        .social-login p::after {
            right: 0;
        }

        .social-icons {
            display: flex;
            justify-content: center;
            gap: 15px;
        }

        .social-icons a {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            color: white;
            text-decoration: none;
            transition: all 0.3s ease;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
        }

        .social-icons a:hover {
            transform: translateY(-3px);
        }

        .social-icons a:nth-child(1) {
            background: #3b5998;
        }

        .social-icons a:nth-child(2) {
            background: #1da1f2;
        }

        .social-icons a:nth-child(3) {
            background: #db4437;
        }

        .register-link {
            text-align: center;
            margin-top: 25px;
            color: #666;
            font-size: 14px;
        }

        .register-link a {
            color: #ff7b00;
            text-decoration: none;
            font-weight: 600;
            transition: color 0.3s;
        }

        .register-link a:hover {
            color: #ff006a;
            text-decoration: underline;
        }

        /* 注册表单样式 */
        .register-form {
            position: absolute;
            top: 40px;
            left: 40px;
            right: 40px;
            opacity: 0;
            pointer-events: none;
            transition: all 0.5s ease;
        }

        .container.active .login-form {
            opacity: 0;
            pointer-events: none;
        }

        .container.active .register-form {
            opacity: 1;
            pointer-events: all;
        }

        /* 响应式设计 */
        @media (max-width: 480px) {
            .container {
                width: 90%;
                padding: 30px;
            }
        }
    </style>
</head>
<body>
    <div class="container" id="container">
        <!-- 登录表单 -->
        <form class="login-form" action="http://127.0.0.1:5000/login">
            <h2>欢迎回来</h2>
            <div class="input-group">
                <input type="text" required name="username">
                <label>用户名</label>
            </div>
            <div class="input-group">
                <input type="password" required name="password">
                <label>密码</label>
            </div>
            <div class="remember-forgot">
                <label><input type="checkbox"> 记住我</label>
                <a href="#">忘记密码?</a>
            </div>
            <button type="submit" class="btn">登 录</button>
            <div class="social-login">
                <p>或使用以下方式登录</p>
                <div class="social-icons">
                    <a href="#"><i class="fab fa-facebook-f"></i></a>
                    <a href="#"><i class="fab fa-twitter"></i></a>
                    <a href="#"><i class="fab fa-google"></i></a>
                </div>
            </div>
            <div class="register-link">
                还没有账号? <a href="#" id="register">立即注册</a>
            </div>
        </form>

        <!-- 注册表单 -->
        <form class="register-form">
            <h2>创建账号</h2>
            <div class="input-group">
                <input type="text" required>
                <label>用户名</label>
            </div>
            <div class="input-group">
                <input type="email" required>
                <label>电子邮箱</label>
            </div>
            <div class="input-group">
                <input type="password" required>
                <label>设置密码</label>
            </div>
            <div class="input-group">
                <input type="password" required>
                <label>确认密码</label>
            </div>
            <button type="submit" class="btn">注 册</button>
            <div class="register-link">
                已有账号? <a href="#" id="login">立即登录</a>
            </div>
        </form>
    </div>

    <script>
        // 切换登录/注册表单
        const registerBtn = document.getElementById('register');
        const loginBtn = document.getElementById('login');
        const container = document.getElementById('container');

        registerBtn.addEventListener('click', (e) => {
            e.preventDefault();
            container.classList.add('active');
        });

        loginBtn.addEventListener('click', (e) => {
            e.preventDefault();
            container.classList.remove('active');
        });

        // 表单提交
        // const forms = document.querySelectorAll('form');
        // forms.forEach(form => {
        //     form.addEventListener('submit', (e) => {
        //         e.preventDefault();
        //         // 这里可以添加表单验证和AJAX提交
        //         alert('表单提交成功！(演示用)');
        //     });
        // });

        // 输入框动画效果
        const inputs = document.querySelectorAll('.input-group input');
        inputs.forEach(input => {
            input.addEventListener('focus', () => {
                input.parentNode.querySelector('label').style.color = '#ff7b00';
            });
            input.addEventListener('blur', () => {
                if (!input.value) {
                    input.parentNode.querySelector('label').style.color = '#666';
                }
            });
        });
    </script>
</body>
</html>